package com.mingqijia.gassafety.webserver.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <p>
 * 消息推送策略 环境类
 * </p>
 *
 * @author mby
 * @since 2024-01-16
 */
@Component
public class MessageContext {

    /** Spring会自动注入所有实现了MessageStrategy的Bean */
    @Autowired
    private Map<String, MessageStrategy> messageStrategies;

    public MessageStrategy getMessageStrategy(String strategyName) {
        return messageStrategies.get(strategyName);
    }


}
